import request from '@/utils/request'

// 查询收货单列表
export function listReceipt(query) {
  return request({
    url: '/depot/receipt/list',
    method: 'get',
    params: query
  })
}

export function someApiCall(row){
  return request({
    url:'/depot/receipt/validateBeforeReceiving',
    method: 'get',
    params: {receiptId: row}
  })
}

// 查询收货单详细
export function getReceipt(receiptId) {
  return request({
    url: '/depot/receipt/' + receiptId,
    method: 'get'
  })
}

// 查询收货单详细
export function getUpdateReceipt(receiptId) {
  return request({
    url: '/depot/receipt/update/' + receiptId,
    method: 'get'
  })
}

// 新增收货单
export function addReceipt(data) {
  return request({
    url: '/depot/receipt',
    method: 'post',
    data: data
  })
}

// 批量新增收货单
export function batchAddInspection(data) {
  return request({
    url: '/depot/inspection/batch/list',
    method: 'POST',
    data: data
  })
}


// 修改收货单
export function updateReceipt(data) {
  return request({
    url: '/depot/receipt',
    method: 'put',
    data: data
  })
}

// 删除收货单
export function delReceipt(receiptId) {
  return request({
    url: '/depot/receipt/' + receiptId,
    method: 'delete'
  })
}

// 采购订单树状图
export function getProcuredOrdersTree(query) {
  return request({
    url: '/depot/receipt/procuredOrdersTree',
    method: 'get',
    params: query
  })
}

//通过采购单号查询
export function getSelectOrdersNumber(ordersId) {
  return request({
    url: '/depot/receipt/selectOrdersNumber/' + ordersId,
    method: 'get'
  })
}


// 查询收货单详细
export function getReceiptQuantity(receiptId) {
  return request({
    url: '/depot/receipt/' + receiptId,
    method: 'get'
  })
}


// 收货确认
export function updateReceiptConfirm(data) {
  return request({
    url: '/depot/receipt/updateReceiptConfirm',
    method: 'put',
    data: data
  })
}


// 批量新增收货单
export function batchAddReceipt(data) {
  return request({
    url: '/depot/receipt/batchAddReceipt',
    method: 'post',
    data: data
  });
}

